<template>
	<view class="uni-common-mt">
		<view class="" style="width: 100%; height: 40vh; background: #4e72d5;">
<!-- 			<view class="uni-form-item uni-column" style="width: 80%; margin:5% auto 0 auto;">
				<view class="title" style="color: white;">用户名</view>
				<text style="color: white;">{{user_info.user_name}}</text>
			</view> -->
			<view class="" style="width: 50%; margin: 0 auto 0 auto; width: 50%; height: 20vh;">
				<image src="../../static/me-icon.png" mode="aspectFit" style="width: 50%; margin:0 0 0 25%;" v-if="user_info.type=='leader'"></image>
				<image src="../../static/people.png" mode="aspectFit" style="width: 50%; margin:0 0 0 25%;" v-if="user_info.type=='people'"></image>
			</view>
			<view class="uni-form-item uni-column" style="width: 80%; margin:9% auto 0 auto;">
<!-- 				<view class="title" style="color: white;">姓名</view> -->
				<p style="color: white; text-align: center;">{{user_info.nick_name}}</p>
			</view>
		</view>
		<view class="uni-form-item uni-column" style="width: 80%; margin:5% auto 0 auto;"  v-if="user_info.type=='people'">
			<button @tap="toMyPost">我的留言</button>
		</view>
		<view class="uni-form-item uni-column" style="width: 80%; margin:5% auto 0 auto;"  v-if="user_info.type=='leader'">
			<button @tap="toMyPost">收到留言</button>
		</view>
		<view class="uni-form-item uni-column" style="width: 80%; margin:45% auto 0 auto;">
			<button @tap="exit" type="warn">退出登录</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user_info:""
			}
		},
		onLoad() {
			let value = uni.getStorageSync('user_info');
			this.user_info=value
		},
		methods: {
			toMyPost(){
				// uni.navigateTo({
				// 	url:"/pages/myPost/myPost"
				// })
				uni.navigateTo({
					url:"/pages/posts/posts"
				})
			},
			exit(){
				uni.removeStorageSync('user_info');
				uni.reLaunch({
					url:"/pages/login/login"
				})
			}
		}
	}
</script>

<style scoped>

</style>
